import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    avatarPath: '',// 用户头像
    nickname: '', // 用户昵称
    keyWord: ''
  },
  mutations: {
    SETAVATARPATH(state, avatarPath) {
      state.avatarPath = avatarPath;
    },
    SETNICKNAME(state, nickname) {
      state.nickname = nickname;
    },
    SETKEYWORD(state, keyWord) {
      state.keyWord = keyWord;
    }
  },
  actions: {
    setAvatarPath(context, avatarPath) {
      context.commit('SETAVATARPATH', avatarPath)
    },
    setNickname(context, nickname) {
      context.commit('SETNICKNAME', nickname)
    },
    setKeyWord(context, keyWord) {
      context.commit('SETKEYWORD', keyWord)
    }
  },
  modules: {
  }
})
